package org.jeecg.modules.bobo.common.service.impl;

import org.jeecg.modules.bobo.common.entity.LbSlide;
import org.jeecg.modules.bobo.common.entity.LbSlideItem;
import org.jeecg.modules.bobo.common.mapper.LbSlideItemMapper;
import org.jeecg.modules.bobo.common.mapper.LbSlideMapper;
import org.jeecg.modules.bobo.common.service.ILbSlideService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.util.List;
import java.util.Collection;

/**
 * @Description: 轮播图分组
 * @Author: jeecg-boot
 * @Date:   2020-11-26
 * @Version: V1.0
 */
@Service
public class LbSlideServiceImpl extends ServiceImpl<LbSlideMapper, LbSlide> implements ILbSlideService {

	@Autowired
	private LbSlideMapper lbSlideMapper;
	@Autowired
	private LbSlideItemMapper lbSlideItemMapper;
	
	@Override
	@Transactional
	public void delMain(String id) {
		lbSlideItemMapper.deleteByMainId(id);
		lbSlideMapper.deleteById(id);
	}

	@Override
	@Transactional
	public void delBatchMain(Collection<? extends Serializable> idList) {
		for(Serializable id:idList) {
			lbSlideItemMapper.deleteByMainId(id.toString());
			lbSlideMapper.deleteById(id);
		}
	}

    @Override
    public String getSlideByCode(String slideCode) {
        return lbSlideMapper.getSlideByCode(slideCode);
    }

}
